package org.example.cdpcrpbackend.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import lombok.RequiredArgsConstructor;
import org.example.cdpcrpbackend.controller.dto.CrpItem1;
import org.example.cdpcrpbackend.domain.CrpItem;
import org.example.cdpcrpbackend.mapper.CrpItemMapper;
import org.example.cdpcrpbackend.service.CrpItemService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class CrpItemServiceImpl extends ServiceImpl<CrpItemMapper, CrpItem> implements CrpItemService {
    private final CrpItemMapper crpItemMapper;

    @Override
    public CrpItem1 getItemAndModById(String id) {
        return crpItemMapper.getItemAndModById(id);
    }

    @Override
    public List<CrpItem1> listByPage(String key, String mid, Integer page, Integer size) {
        PageHelper.startPage(page, size);
        return crpItemMapper.listByCondition(mid, key);
    }
}
